package com.zzh.springairobort.function;

import java.util.function.Function;

/**
 * @author 张 志 豪
 * @version 1.0
 */
//定义LocationWeatherFunctionCall类，实现Function接口
//返回固定信息
public class LocationWeatherFunctionCall implements Function<LocationWeatherFunctionCall.Request, LocationWeatherFunctionCall.Response> {

    //实现Function接口的apply方法
    @Override
    public Response apply(Request request) {
        //实现业务逻辑
        if (request.location.equals("北京")){
            return new Response("北京的天气很好");
        }

        else if (request.location.equals("广州")){
            return new Response("广州的天气很好");
        }
        return null;
    }

    public record Request(String location, String weather){}

    public record Response(String message){}
}
